const fs = require('fs');
const zlib = require('zlib');

var startTime = new Date();
var cnt = 0;

// var rds = fs.createReadStream('input.txt');
// var zip = zlib.createGzip();
// var wrs = fs.createWriteStream('data2.rar');


var rdzip = fs.createReadStream('data2.rar');
var unzip = zlib.createGunzip();
var wrstxt = fs.createWriteStream('data1.txt');

rdzip.pipe(unzip).pipe(wrstxt);

wrstxt.on('finish', function(){
    console.log('写入完成！');
    var endTime = new Date();
    console.log('总耗时：' + (endTime - startTime) + '毫秒。')
});

console.log('程序执行完毕！');